/**
 * @description: main
 * @date: 2022-04-12 14:32
 */
import { defineStore } from 'pinia'

export const useMainStore = defineStore({
  id: 'main',
  state: () => ({
    // pc/pad/mobile => 大屏、小屏、移动端
    device: 'pc',
    // 全屏加载
    loading: false,
    // 主题 light/dark
    theme: 'light'
  }),
  getters: {
    isPc: state => state.device === 'pc',
    isMobile: state => state.device === 'mobile'
  },
  actions: {
    setDevice (device) {
      this.device = device
    },
    setLoading (loading) {
      this.loading = loading
    },
    setTheme (theme) {
      this.theme = theme
    }
  }
})
